<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- adaptations.qdoc -->
  <title>Scene Graph Adaptations | Qt Quick 5.12.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtquick-index.html">Qt Quick 模块</a></td><td >场景图适配</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtquick-index.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">目录</a></h3>
<ul>
<li class="level1"><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-adaptations.html#scene-graph-adaptations-in-qt-quick">Qt Quick 中的场景图适配</a></li>
<li class="level1"><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-adaptations.html#switching-between-the-adaptation-used-by-the-application">在应用程序使用的适配之间切换</a></li>
<li class="level1"><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-adaptations.html#opengl-es-2-0-and-opengl-2-0-adaptation">OpenGL ES 2.0 和 OpenGL 2.0 适配</a></li>
<li class="level1"><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-adaptations.html#software-adaptation">软件适配</a></li>
<li class="level1"><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-adaptations.html#direct3d-12-experimental">Direct3D 12（实验性）</a></li>
<li class="level1"><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-adaptations.html#openvg">OpenVG</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">场景图适配</h1>
<span class="subtitle"></span>
<!-- $$$qtquick-visualcanvas-adaptations.html-description -->
<div class="descr"> <a name="details"></a>
<a name="scene-graph-adaptations-in-qt-quick"></a>
<h2 id="scene-graph-adaptations-in-qt-quick">Qt Quick 中的场景图适配</h2>
<p>最初 Qt Quick 总是依赖 OpenGL（OpenGL ES 2.0 或 OpenGL 2.0）来解析场景图并将结果渲染到渲染目标。从 Qt 5.8 开始，Qt Quick 还支持软件渲染和 Direct3D 12。</p>
<a name="switching-between-the-adaptation-used-by-the-application"></a>
<h2 id="switching-between-the-adaptation-used-by-the-application">在应用程序使用的适配之间切换</h2>
<p>默认的渲染后端仍然是OpenGL，或者——在Qt构建中禁用了OpenGL支持——软件渲染器。这可以通过使用环境变量或C++ 
API来覆盖。前者包括在启动应用程序之前设置<code>QT_QUICK_BACKEND</code> 或遗留的<code>QMLSCENE_DEVICE</code> 
环境变量。后者是通过在应用程序的main()函数中调用<a href="qquickwindow.html#setSceneGraphBackend">QQuickWindow::setSceneGraphBackend</a>()来实现的。</p>
<p>支持的后端如下</p>
<ul>
<li>OpenGL - 由字符串<code>""</code>或枚举值<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qsgrendererinterface.html#GraphicsApi-enum">QSGRendererInterface::OpenGL</a>请求。</li>
<li>Software - 由字符串<code>"software"</code>或枚举值<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qsgrendererinterface.html#GraphicsApi-enum">QSGRendererInterface::Software</a>请求。</li>
<li>Direct3D 12 - 由字符串<code>"d3d12"</code>或枚举值<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qsgrendererinterface.html#GraphicsApi-enum">QSGRendererInterface::Direct3D12</a>请求。</li>
<li><a href="qtquick-visualcanvas-adaptations.html#openvg">OpenVG</a> - 由字符串<code>"openvg"</code>或枚举值<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qsgrendererinterface.html#GraphicsApi-enum">QSGRendererInterface::OpenVG</a>请求。</li>
</ul>
<p>如果不确定正在使用哪个后端，请通过<code>QSG_INFO</code>环境变量或<code>qt.scenegraph.general</code>日志记录类别启用基本场景图信息日志记录。这将导致在应用程序启动期间将一些信息打印到调试输出上。</p>
<p><b>注意：</b>除 OpenGL 之外的适配通常会带来一系列限制，因为它们不太可能提供与 OpenGL 100% 兼容的功能集。但是，它们可能会在某些领域提供自己的特定优势。有关各种改编的更多信息，请参阅以下部分。</p><a name="opengl-es-2-0-and-opengl-2-0-adaptation"></a>
<h2 id="opengl-es-2-0-and-opengl-2-0-adaptation">OpenGL ES 2.0 和 OpenGL 2.0 适配</h2>
<p>能够提供完整 Qt Quick 2 功能集的默认适配是 OpenGL 适配。OpenGL适配的所有细节都可以在这里找到：<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-scenegraph-renderer.html">OpenGL Adaptation</a></p>
<a name="software-adaptation"></a>
<h2 id="software-adaptation">软件适配</h2>
<p>软件适配是<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-index.html">Qt Quick 模块</a>2 的替代渲染器，它使用光栅绘制引擎来渲染场景图的内容。此处提供了此适配的详细信息：<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-adaptations-software.html">软件适配</a></p>
<a name="direct3d-12-experimental"></a>
<h2 id="direct3d-12-experimental">Direct3D 12（实验性）</h2>
<p>Direct3D 12是在Windows 10上运行的<a href="qtquick-index.html">Qt Quick 模块</a>的另一种渲染器，适用于Win32和UWP应用程序。这个适配的细节可以在这里找到:<a href="qtquick-visualcanvas-adaptations-d3d12.html">Direct3D 
12适配</a></p>
	<a name="openvg"></a>
<h2 id="openvg">OpenVG</h2>
<p><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-adaptations.html#openvg">OpenVG</a>适配是<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-index.html">Qt Quick 模块</a>2的替代渲染器，它将使用<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-adaptations.html#openvg">OpenVG</a>命令渲染场景图的内容，以提供硬件加速的 2D 矢量和光栅图形。此适配的详细信息可在此处获得：<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-adaptations-openvg.html">OpenVG 适配</a></p>
</div>
<!-- @@@qtquick-visualcanvas-adaptations.html -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
